package com.scjst.controller;

import com.sun.org.apache.bcel.internal.generic.RETURN;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.HttpMediaTypeException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class loginController {

    @RequestMapping("/login")
    public  String login()
    {
      return  "login";
    }
    @RequestMapping("/formEdit")
    public  String formEdit()
    {
        return  "formEdit";
    }
    @RequestMapping("/formEdit_v1")
    public  String formEdit_v1()
    {
        return  "formEdit_v1";
    }
    @RequestMapping("/infoList")
    public  String infoList()
    {
        return  "infoList";
    }
    @RequestMapping("/main")
    public  String main()
    {
        return  "main";
    }
    @RequestMapping("/index")
    public  String index()
    {
        return  "index";
    }
    @RequestMapping("/test")
    public  String test()
    {
        return  "test";
    }

    @RequestMapping("/loginservice")
    public  String loginservice(HttpServletRequest request)
    {
        String uname=request.getParameter("uname");
        String password=request.getParameter("upassword");
        if (uname=="admin"&&password=="1")
        {
            request.getSession().setAttribute("uname","admin");
            request.getSession().setAttribute("uroles","test:show,user:list");
            return "main";
        }
        else
        {
            return  "login";
        }
    }
    @RequestMapping("/personMain")
    public  String personMain()
    {
        return  "personMain";
    }

    @RequestMapping("/EntMain")
    public  String entMain()
    {
        return  "EntMain";
    }
}
